section .text
bits 32

global atomic_inc
global atomic_dec

; int atomic_inc(int *)
atomic_inc:
    xor eax,eax
    mov ecx,[esp+4]
    mov eax,1
    lock
    xadd [ecx],eax
    ret

; int atomic_dec(int *)
atomic_dec:
    xor eax,eax
    mov ecx,[esp+4]
    mov eax,-1
    lock
    xadd [ecx],eax
    ret
